/**
 * Created by zhangligang
 * Email: tzhang2450@163.com
 * Date: 2019/1/19
 * Time: 23:41
 */
$(function () {
    sendAjax('/v1/user/star.json', 'get', {}, function (json) {
        var data = json.body;
        var star = '';
        var level = '警示党员';
        if (data.score >= 90) {
            level = '优秀党员';
        } else if (data.score >= 60) {
            level = '合格党员';
        } else {
            level = '警示党员';
        }
       $('.user-rule').html(data.rule);
        var count = 0;
        if (data.score >= 90) {
            count = 5;
        } else if (data.score >= 60) {
            count = 3;
        } else {
            count = 0;
        }
        for (var i = 1; i <= count; i ++) {
            star += '<i class="fa fa-star"></i>';
        }
       $('.user-star').html(getLevelName(data.level));
       $('.user-level').html(level);
       $('.user-advice').html(data.advice);
    });

});